package Hot100.Skill_question;

import java.util.HashMap;
import java.util.Map;

public class findDuplicate {
    public static void main(String[] args) {

    }
    public int findDuplicate(int[] nums) {
        Map map = new HashMap();
        for (int i = 0; i < nums.length; i++) {
            if(map.containsKey(nums[i])){
                return nums[i];
            }else {
                map.put(nums[i],1);
            }
        }
        return -1;
    }
}
